function api(methods,url,params,callback){

    var httpRequire = new XMLHttpRequest()
    httpRequire.open(methods,url,true)
    httpRequire.responseText = 'json'
    httpRequire.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    params = params || null
    // try{
    //     params = JSON.stringify(params)
    // }catch{

    // }


    httpRequire.send(params)
    httpRequire.onreadystatechange = function(){
        if(httpRequire.readyState == 4 && httpRequire.status == 200){
            var data = httpRequire.responseText
            callback(data)
        }
    }
    }
